package com.angel.arquitectura.dao.impl.errorMessage;

import com.angel.arquitectura.dao.errorMessage.ErrorMessageDAO;
import com.angel.arquitectura.model.errorMessage.ErrorMessage;
import com.angel.arquitectura.model.objectId.ObjectId;
import com.angel.dao.generic.impl.GenericSpringHibernateDAO;
import org.hibernate.criterion.Restrictions;

import java.util.Collection;
import java.util.Date;


public class ErrorMessageSpringHibernateDAO extends GenericSpringHibernateDAO<ErrorMessage, ObjectId> implements ErrorMessageDAO {

    public ErrorMessageSpringHibernateDAO(){
        super(ErrorMessage.class, ObjectId.class);
    }

    public Collection<ErrorMessage> findAllByOtherDetails(String otherDetails) {
        return super.findAll("otherDetails", otherDetails);
    }

    public Collection<ErrorMessage> findAllBetweenCreationDate(Date afterCreatioDate, Date beforeCreationDate ) {
        return super.findAllByCriteria(Restrictions.between("fechaCreacion", afterCreatioDate, beforeCreationDate));
    }
}